package com.cloud.user_info.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cloud.entity.AuthUser;
import com.cloud.entity.SysUserAuth;
import com.cloud.entity.vo.AuthParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户第三方授权
 *
 * @author yzj
 * @since 2022-05-09
 */
@Mapper
public interface SysUserAuthMapper extends BaseMapper<SysUserAuth> {

    /**
     * 查询账户授权列表
     *
     * @param param
     * @return
     */
    public List<SysUserAuth> selectUserAuthList(@Param("param") SysUserAuth param);

    /**
     * 根据编码获取用户授权信息
     */
    public SysUserAuth selectUserAuthByCode(@Param("param") AuthUser param);

    /**
     * 删除授权信息
     *
     * @param authIds
     * @return
     */
    public int deleteUserAuthById(@Param("authId") List<Long> authIds);

    /**
     * 根据类型获取授权ID列表
     *
     * @param param
     * @return
     */
    public List<String> getUserAuthIds(@Param("param") AuthParam param);

    /**
     * 根据UserId查询授权列表
     *
     * @param userId
     * @return
     */
    public List<SysUserAuth> selectUserAuthById(@Param("userId") Long userId);

    /**
     * 根据用户id修改授权状态
     *
     * @param param
     * @return
     */
    public int updateStateByUserId(@Param("param") SysUserAuth param);

    /**
     * 检验用户授权信息是否存在
     *
     * @param param
     * @return
     */
    public int checkUserAuthUnique(@Param("param") SysUserAuth param);

}
